//
//  UENavigatorCell.m
//  UEHtml-iOS
//
//  Created by ShadowKnight on 13-9-28.
//  Copyright (c) 2013年 Qun He. All rights reserved.
//

#import "UENavigatorCell.h"
#import "UIConstanstDefine.h"

@implementation UENavigatorCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
//        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        self.contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Function_cell_bg_normal.png"]];
        
        _optionName = [[UILabel alloc]initWithFrame:CGRectMake(53.0f, 33.0f, 150.0f, 20.0f)];
        _optionName.backgroundColor = [UIColor clearColor];
        _optionName.textColor = HEXCOLOR(0xcacaca);
        _optionName.textAlignment = NSTextAlignmentLeft;
        _optionName.font = [UIFont systemFontOfSize:18.0f];
        [self.contentView addSubview:_optionName];
        
        self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.frame];
        self.selectedBackgroundView.backgroundColor = HEXCOLOR(0x55575c);
        
        _iconOfItem = [[UIImageView alloc]initWithFrame:CGRectMake(18.0f, 33.0f, 19.0f, 19.0f)];
        [self.contentView addSubview:_iconOfItem];
        
        UIImageView* cellSeparateLine = [[UIImageView alloc] initWithFrame:CGRectMake(0, 85, 320, 1)];
        [cellSeparateLine setImage:createImageWithColor(HEXCOLOR(0x2a2826))];
        [self.contentView addSubview:cellSeparateLine];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
    if(!selected)
    {
        self.selectedBackgroundView.backgroundColor = HEXCOLOR(0x55575c);
    }
    switch (self.index) {
        case 0:
            
            self.iconOfItem.image = IMAGE_BY_NAMED(selected?@"LeftDrawer_Home_select.png":@"LeftDrawer_Home_normal.png");
            break;
        case 1:
            self.iconOfItem.image = IMAGE_BY_NAMED(selected?@"LeftDrawer_navi_select.png":@"LeftDrawer_navi_normal.png");
            break;
        case 2:
            self.iconOfItem.image = IMAGE_BY_NAMED(selected?@"LeftDrawer_icon_coolSite_select.png":@"LeftDrawer_icon_coolSite_Normal.png");
            break;
        case 3:
            self.iconOfItem.image = IMAGE_BY_NAMED(selected?@"LeftDrawer_Insprite_select.png":@"LeftDrawer_Insprite_normal.png");
            break;
        case 4:
            self.iconOfItem.image = IMAGE_BY_NAMED(selected?@"LeftDrawer_Setting_select.png":@"LeftDrawer_Setting_normal.png");
            break;
        default:
            break;
    }
}

-(void)setDefaultIcon
{
    
}

@end
